# print(''.join('今天天气真好'))
# s1 = "-"
# s2 = ""
# seq = ("r", "u", "n", "o", "o", "b") # 字符串序列
# print (s1.join( seq ))
# print (s2.join( seq ))

# def funcD(a, b, *c):
#     print(a)
#     print(b)
#     print("length of c is: %d " % len(c))
#     print(c)
# funcD(1,2,'sss',12,22)


# def funcF(a, **b):
#   print(a)
#   for x in b:
#     print( x + ": " + str(b[x]))
# funcF(100,aa=11, c='你好', b=200)

# def mul(a):
#     def add(b,c):
#         print(a*b+c)
#     return add
#
# aa=mul(10)
# print(aa)
# print(aa.__name__)
# aa(2,3)
# shell()
# buy()

'''
json与字典的区别？
    json：是一个数据格式，本身就是字符串类型
    dict:  数据类型，可以储存，pycharm控制台打印显示一定是单引号

    b = '{"psw":"123"}'为字符串， 字符串b(json格式的)转字典为json.loads(b)
'''
#字典类型
# a = {"name":"sq"}
# print(a)
#
# #json
# b = '{"psw":"123"}'
# print(b)
import json

#a为字典
a = {'name':'sq'}
print(type(a))
print(a)

print('-----------------')

#字典转化成json(字符串)
print(type(json.dumps(a)))
print(json.dumps(a))

print('------------------')

#b为字符串，转为字典
b = '{"psw":"123"}'

print(type(json.loads(b)))
print(json.loads(b))
print(eval(b))

clist = []
clist.append(json.dumps(a))#添加为字符串格式的
clist.append(a)#添加为字典格式的
print(clist)


# -*- coding: utf-8 -*-
# @Time    : 2024/3/13 15:20
# @Author  : Liaogan
# @FileName: __init__.py.py
list={'code': 200, 'message': 'success', 'data': []}
print(type(list['code']))

import json

data = {
    'name': 'John',
    'age': 30,
    'city': 'New York'
}

json_string = json.dumps(data)
print(json_string)

import json

json_string = '{"name": "John", "age": 30, "city": "New York"}'

data = json.loads(json_string)
print(data)